package com.ctsi.ssdc.admin.repository;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

import com.ctsi.ssdc.admin.domain.CscpWorkGroupOrg;
import com.ctsi.ssdc.admin.domain.CscpWorkGroupOrgExample;
import com.ctsi.ssdc.database.annotation.InjectByDataBaseType;
import com.ctsi.ssdc.database.enums.EnumDatabaseName;

/**
 * @author MyBatis Generator
*/
@InjectByDataBaseType(includes= {EnumDatabaseName.ORACLE})
public interface CscpWorkGroupOrgRepository {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @SelectProvider(type=CscpWorkGroupOrgSqlProvider.class, method="countByExample")
    long countByExample(CscpWorkGroupOrgExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @DeleteProvider(type=CscpWorkGroupOrgSqlProvider.class, method="deleteByExample")
    int deleteByExample(CscpWorkGroupOrgExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @Delete({
        "delete from cscp_work_group_org",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);
    
    @Delete({
        "truncate table cscp_work_group_org"
    })
    int truncateCscpWorkGroupOrg();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @Insert({
        "insert into cscp_work_group_org (group_id, org_id)",
        "values (#{groupId,jdbcType=INTEGER}, #{orgId,jdbcType=INTEGER})"
    })
    @Options(useGeneratedKeys=true, keyProperty="id")
    int insert(CscpWorkGroupOrg record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @InsertProvider(type=CscpWorkGroupOrgSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true, keyProperty="id")
    int insertSelective(CscpWorkGroupOrg record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @SelectProvider(type=CscpWorkGroupOrgSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="group_id", property="groupId", jdbcType=JdbcType.INTEGER),
        @Result(column="org_id", property="orgId", jdbcType=JdbcType.INTEGER)
    })
    List<CscpWorkGroupOrg> selectByExample(CscpWorkGroupOrgExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @Select({
        "select",
        "id, group_id, org_id",
        "from cscp_work_group_org",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="group_id", property="groupId", jdbcType=JdbcType.INTEGER),
        @Result(column="org_id", property="orgId", jdbcType=JdbcType.INTEGER)
    })
    CscpWorkGroupOrg selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @UpdateProvider(type=CscpWorkGroupOrgSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CscpWorkGroupOrg record, @Param("example") CscpWorkGroupOrgExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @UpdateProvider(type=CscpWorkGroupOrgSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CscpWorkGroupOrg record, @Param("example") CscpWorkGroupOrgExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @UpdateProvider(type=CscpWorkGroupOrgSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CscpWorkGroupOrg record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @Update({
        "update cscp_work_group_org",
        "set group_id = #{groupId,jdbcType=INTEGER},",
          "org_id = #{orgId,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(CscpWorkGroupOrg record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table cscp_work_group_org
     *
     * @mbg.generated Thu May 03 10:11:12 CST 2018
     */
    @SelectProvider(type=CscpWorkGroupOrgSqlProvider.class, method="selectByExampleWithPage")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="group_id", property="groupId", jdbcType=JdbcType.INTEGER),
        @Result(column="org_id", property="orgId", jdbcType=JdbcType.INTEGER)
    })
    List<CscpWorkGroupOrg> selectByExamplewithPage(CscpWorkGroupOrgExample example);
}